home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / usenet / sources / volume89 / unix / shel302a.1 < prev    next >
Text File  |  1989-03-15  |  52KB  |  2,162 lines

  1. Path: xanth!nic.MR.NET!hal!cwjcc!tut.cis.ohio-state.edu!bloom-beacon!apple!bbn!ulowell!page
  2. From: page@swan.ulowell.edu (Bob Page)
  3. Newsgroups: comp.sources.amiga
  4. Subject: v89i058:  shell - csh-like command interpreter v3.02a, Part01/03
  5. Message-ID: <12242@swan.ulowell.edu>
  6. Date: 15 Mar 89 19:38:32 GMT
  7. Organization: University of Lowell, Computer Science Dept.
  8. Lines: 2151
  9. Approved: page@swan.ulowell.edu
  10.  
  11. Submitted-by: PERUGIA@ICNUCEVM.BITNET (Cesare Dieni)
  12. Posting-number: Volume 89, Issue 58
  13. Archive-name: unix/shell302a.1
  14.  
  15. New to 3.02A:
  16.  
  17. - New commands: fornum, forline, strleft, strright, strmid, strlen, exec.
  18. - Improved commands: foreach, pri.
  19. - New system variable _clinumber.
  20. - You can now split long lines in source files (see source for details).
  21. - window -q now lists also position of screens/windows, not only dimension.
  22. - Since strings are handled directly from Shell with new commands,
  23.   rpn is now used only for calculations; string commands are gone.
  24.   However, now RPN is really usable.
  25. - Changed rawgets() to fix some problems with function keys, multi-line
  26.   editing and window resizing; also, fixed bug with ^E.
  27. - cat now warns you if it can't find any file matching your pattern.
  28. - Now uses DOS packets to get ptr to CLI window; this fixes a bug that
  29.   caused problems if Shell was run on unactive windows.
  30. - Fixed minor bugs (htype printed some more ASCII bytes, some commands
  31.   returned random values, history didn't print CR's).
  32.  
  33. #    This is a shell archive.
  34. #    Remove everything above and including the cut line.
  35. #    Then run the rest of the file through sh.
  36. #----cut here-----cut here-----cut here-----cut here----#
  37. #!/bin/sh
  38. # shar:    Shell Archiver
  39. #    Run the following text with /bin/sh to create:
  40. #    comm3.c
  41. #    globals.c
  42. #    main.c
  43. #    makefile
  44. #    rawconsole.c
  45. #    run.c
  46. #    set.c
  47. #    shell.h
  48. #    shellfunctions.h
  49. # This archive created: Wed Mar 15 14:13:36 1989
  50. cat << \SHAR_EOF > comm3.c
  51. /*
  52.  * COMM3.C
  53.  *
  54.  * Version 3.02A by Carlo Borreo & Cesare Dieni 20-Dec-88
  55.  *
  56.  */
  57.  
  58. do_assign() {
  59. switch(ac) {
  60.     case 1:  assignlist();
  61.          break;
  62.     case 2:  doassign(av[1], NULL);
  63.          break;
  64.     case 3:  doassign(av[1], av[2]);
  65.          break;
  66.     default: ierror(NULL, 500);
  67.          break;
  68.     }
  69. return 0;
  70. }
  71.  
  72. char *assign_errors[4]={
  73.     "",
  74.     "Name %s is not valid\n",
  75.     "Weird error\n",
  76.     "Can't cancel %s\n"
  77.     };
  78.  
  79. doassign(log, phy)
  80. char *log, *phy;
  81. {
  82. int last=strlen(log) - 1;
  83.  
  84. if (log[last] != ':') fprintf(stderr, "Bad name %s\n", log);
  85. else {
  86.     log[last] = 0;
  87.     fprintf(stderr,assign_errors[Assign(log, phy)],log);
  88.     }
  89. }
  90.  
  91. assignlist()
  92. {
  93. struct DirectoryEntry *de_head=NULL, *de;
  94. char buf[256];
  95. BPTR lock;
  96. int ctr=0;
  97.  
  98. AddDADevs(&de_head, DLF_DEVICES | DLF_VOLUMES | DLF_DIRS);
  99. printf("Devices:\n");
  100. for (de=de_head; de && de->de_Type==DLX_DEVICE; de=de->de_Next) {
  101.     printf("%-8s",de->de_Name);
  102.     if (ctr++ == 5) { ctr=0; printf("\n"); }
  103.     }
  104. printf("\n\nVolumes:\n");
  105. for (    ;
  106.     de && (de->de_Type==DLX_VOLUME || de->de_Type==DLX_UNMOUNTED);
  107.     de=de->de_Next
  108.     )
  109.     printf( "%-16s %s\n",
  110.         de->de_Name,
  111.         de->de_Type == DLX_VOLUME ? "[Mounted]" : ""
  112.         );
  113. printf("\nDirectories:\n");
  114. for (; de && de->de_Type==DLX_ASSIGN; de=de->de_Next) {
  115.     if (lock=Lock(de->de_Name, ACCESS_READ)) {
  116.         PathName(lock, buf, 256L);
  117.         UnLock(lock);
  118.         }
  119.     else
  120.         strcpy(buf,"Unexisting lock");
  121.     printf("%-20s%s\n",de->de_Name,buf);
  122.     }
  123. FreeDAList(&de_head);
  124. }
  125.  
  126. do_join()
  127. {
  128. BPTR sou, dest;
  129. char *buffer;
  130. unsigned int i;
  131. long n;
  132. char *namedest=av[--ac];
  133.  
  134. get_opt("r", &i);
  135. if (options==0 && exists(namedest)) { ierror(namedest,203); return 20; }
  136. if ( (buffer=malloc(8192)) == NULL ) { ierror(NULL,103); return 20; }
  137. if ( (dest=Open(namedest, MODE_NEWFILE)) == NULL )
  138.     { pError(namedest); goto fail1; }
  139. for (i=1; i<ac; i++) {
  140.     if ( (sou=Open(av[i], MODE_OLDFILE)) == NULL ) pError(av[i]);
  141.     else
  142.         while( (n=Read(sou, buffer, 8192L)) > 0 )
  143.             if (Write(dest, buffer, n) != n)
  144.                 { pError(namedest); Close(sou); goto fail2; }
  145.     Close(sou);
  146.     }
  147. fail2:
  148.     Close(dest);
  149. fail1:
  150.     free(buffer);
  151.     return 0;
  152. }
  153.  
  154. #define BUFDIM 512L
  155. #define MAXSTR 256
  156.  
  157. int minstr;
  158.  
  159. strings_in_file(s)
  160. char *s;
  161. {
  162. char c;
  163. char readbuf[BUFDIM+1], strbuf[MAXSTR+1];
  164. register unsigned int i, strctr=0;
  165. BPTR fh;
  166. int out, n;
  167.  
  168. if ( fh=Open(s, MODE_OLDFILE) ) {
  169.     fprintf(stderr, "Strings in %s (len>=%d):\n",s,minstr);
  170.     while ( (n=(int)Read(fh, readbuf, BUFDIM)) > 0 && !CHECKBREAK() )
  171.         for (i=0; i<n; i++) {
  172.         c=readbuf[i];
  173.         if (c<0x20 || c>0x7f) {
  174.             out=(strctr>=minstr);
  175.             if (!out) strctr=0;
  176.             }
  177.         else {
  178.             strbuf[strctr++]=c;
  179.             out=(strctr>=BUFDIM);
  180.             }
  181.         if (out) {
  182.             strbuf[strctr]='\0';
  183.             puts(strbuf);
  184.             strctr=0;
  185.             }
  186.         }
  187.     Close(fh);
  188.     }
  189. else pError(s);
  190. }
  191.  
  192. do_strings()
  193. {
  194. minstr=myatoi(av[--ac],1,255);
  195. all_args("r", strings_in_file, 0);
  196. return 0;
  197. }
  198.  
  199. BPTR myfile[MAXMYFILES];
  200.  
  201. do_open()
  202. {
  203. long mode;
  204. unsigned int n;
  205.  
  206. switch (av[2][0]) {
  207.     case 'r': mode=MODE_OLDFILE; break;
  208.     case 'w': mode=MODE_NEWFILE; break;
  209.     default : ierror(NULL,500); return;
  210.     }
  211. Errno=0;
  212. n=(unsigned int)myatoi(av[3],0,MAXMYFILES); if (Errno) return 20;
  213. myfile[n]=Open(av[1],mode);
  214. return (myfile[n]==NULL);
  215. }
  216.  
  217. do_close()
  218. {
  219. register unsigned int i;
  220. int n;
  221.  
  222. for (i=1; i<ac; i++) {
  223.     Errno=0;
  224.     n=myatoi(av[i],0,MAXMYFILES); if (Errno) return 20;
  225.     myclose(n);
  226.     }
  227. return 0;
  228. }
  229.  
  230. myclose(n)
  231. {
  232. if (myfile[n]) { Close(myfile[n]); myfile[n]=NULL; }
  233. }
  234.  
  235. do_fileslist()
  236. {
  237. register unsigned short i;
  238. int flag=0;
  239.  
  240. printf("Open files:");
  241. for (i=0; i<MAXMYFILES; i++)
  242.     if (myfile[i]) { printf(" %d",i); flag=1; }
  243. if (!flag) printf(" None!");
  244. printf("\n");
  245. return 0;
  246. }
  247.  
  248. BPTR extOpen(name,mode)
  249. char *name;
  250. long mode;
  251. {
  252. if (name[0]=='.') return myfile[atoi(name+1)];
  253. return Open(name,mode);
  254. }
  255.  
  256. extClose(fh)
  257. BPTR fh;
  258. {
  259. register unsigned short i;
  260.  
  261. for (i=0; i<MAXMYFILES; i++)
  262.     if (myfile[i]==fh) return;
  263. Close(fh);
  264. }
  265.  
  266. do_resident(avline)
  267. char *avline;
  268. {
  269. unsigned int i;
  270. BPTR seg;
  271. struct ResidentPrgNode *p;
  272. char *args;
  273.  
  274. get_opt("ar", &i);
  275. switch (options) {
  276.     case 0:
  277.     ObtainSemaphore (& (ArpBase->ResPrgProtection) );
  278.     if (p=ArpBase->ResidentPrgList) {
  279.         printf("Name             Users\n");
  280.         for (; p; p=p->rpn_Next)
  281.             printf("%-16s %-3ld\n",p->rpn_Name,p->rpn_Usage);
  282.         }
  283.     else printf("No resident program(s)\n");
  284.     ReleaseSemaphore(& (ArpBase->ResPrgProtection) );
  285.     break;
  286.     case 1:
  287.     for (; i<ac; i++)
  288.         if ( (seg=(BPTR)LoadPrg(av[i])) && AddResidentPrg(seg,av[i]) )
  289.             printf("OK! %s is now resident\n", BaseName(av[i]));
  290.         else pError(av[i]);
  291.     break;
  292.     case 2:
  293.     for (; i<ac; i++)
  294.         if (RemResidentPrg(av[i])) ierror(av[i],202);
  295.         else printf("Removed %s\n",av[i]);
  296.     break;
  297.     default:
  298.     ierror(NULL,500);
  299.     break;
  300.     }
  301. return 0;
  302. }
  303.  
  304. struct ProcessControlBlock pcb={
  305.     4000,        /* pcb_StackSize    */
  306.     0,        /* pcb_Pri        */
  307.     };
  308. /* remaining field are NULL */
  309.     
  310. do_truerun(avline, backflag)
  311. char *avline;
  312. {
  313. char name[200];
  314. char *FindIt();
  315.  
  316. if (backflag) {
  317.     pcb.pcb_Control=NULL;
  318.     pcb.pcb_Input=pcb.p_Output=Open("NIL:",MODE_OLDFILE);
  319.     }
  320. else {
  321.     pcb.pcb_Control=PRB_SAVEIO;
  322.     pcb.pcb_Input=pcb.p_Output =NULL;
  323.     }
  324. if (FindIt(av[1], "", name))
  325.     ASyncRun(name,next_word(next_word(avline)),&pcb);
  326. else
  327.     ierror(av[1],205);
  328. return 0;
  329. }
  330.  
  331. int exists(name)
  332. char *name;
  333. {
  334. BPTR lock;
  335.  
  336. if (lock=Lock(name,ACCESS_READ)) {
  337.     UnLock(lock);
  338.     return 1;
  339.     }
  340. return 0;
  341. }
  342.  
  343. do_aset()
  344. {
  345. Setenv(av[1],av[2]);
  346. return 0;
  347. }
  348.  
  349. #define HTYPELINE 16L
  350.  
  351. htype_a_file(s)
  352. char *s;
  353. {
  354. BPTR fh;
  355. long n, filesize=0;
  356. char buf[HTYPELINE+1];
  357. register unsigned int i;
  358.  
  359. if ( (fh=Open(s,MODE_OLDFILE))==NULL ) { pError(s); return 20; }
  360. while ( (n=Read(fh,buf,HTYPELINE))>0 && !dobreak()) {
  361.     printf("%06lx: ",filesize);
  362.     filesize+=n;
  363.     for (i=0; i<n; i++) {
  364.         printf( (i&3) ? "%02x" : " %02x",(int)(unsigned char)buf[i]);
  365.         if (buf[i]<=0x20) buf[i]='.';
  366.         }
  367.     for ( ; i<HTYPELINE; i++) {
  368.         printf( (i&3) ? "  " : "   ");
  369.         buf[i]=' ';
  370.         }
  371.     buf[i]=0;
  372.     printf("    %s\n",buf);
  373.     }
  374. Close(fh);
  375. return 0;
  376. }
  377.  
  378. do_htype()
  379. {
  380. all_args("", htype_a_file, 0);
  381. return 0;
  382. }
  383.  
  384. do_stack()
  385. {
  386. long n;
  387.  
  388. if (ac>1) {
  389.     Errno=0;
  390.     n=Atol(av[1]);
  391.     if (!Errno) Mycli->cli_DefaultStack=(long)(n >> 2L);
  392.     }
  393. else printf("current stack size is %ld bytes\n",
  394.                 (long)Mycli->cli_DefaultStack << 2L);
  395. return 0;
  396. }
  397.  
  398. do_fault()
  399. {
  400. struct PERROR *p;
  401. register unsigned int i;
  402. int n;
  403.  
  404. for (i=1; i<ac; i++) {
  405.     n=myatoi(av[i],0,32767);
  406.     if (!Errno) {
  407.         for (p=Perror; p->errnum && p->errnum!=n; p++);
  408.         if (p->errnum)
  409.             printf("Fault %d: %s\n",n,p->errstr);
  410.         else
  411.             printf("Fault %d not recognized\n",n);
  412.         }
  413.     }
  414. return 0;
  415. }
  416.  
  417. struct rpncommand {
  418.     char *str;
  419.     int parsin, parsout;
  420.     };
  421.  
  422. struct rpncommand rpn[]={
  423.     "+",    2,    1,
  424.     "-",    2,    1,
  425.     "*",    2,    1,
  426.     "/",    2,    1,
  427.     "%",    2,    1,
  428.     "&",    2,    1,
  429.     "|",    2,    1,
  430.     "~",    1,    1,
  431.     ">",    2,    1,
  432.     "<",    2,    1,
  433.     "==",    2,    1,
  434.     "!",    1,    1,
  435.     "DUP",    1,    2,
  436.     "DROP",    1,    0,
  437.     "SWAP",    2,    2,
  438.     "HELP",    0,    0,
  439.     NULL,    0,    1,    /* this looks for a number */
  440. };
  441.  
  442. do_rpn(garbage,ifflag) /* ifflag!=0 if called from if */
  443. char *garbage;
  444. {
  445. register long n0, n1;
  446. long t;
  447. unsigned int i, j;
  448. int sp=0;
  449. long stack[100];
  450. struct rpncommand *temp;
  451.  
  452. i=1;
  453. if (ifflag) get_opt("rn",&i);
  454. for (; i<ac; i++) {
  455.     for (j=0; rpn[j].str && Strcmp(rpn[j].str,av[i]); j++) ;
  456.     n0=stack[sp-1];
  457.     n1=stack[sp-2];
  458.     sp -= (rpn[j].parsin);
  459.     if (sp<0) { fprintf(stderr, "RPN: Empty stack\n"); return 1; }
  460.     switch (j) {
  461.       case 0:    n0 += n1;        break;
  462.       case 1:    n0 = n1-n0;        break;
  463.       case 2:    n0 *= n1;        break;
  464.       case 3:    n0 = n1/n0;        break;
  465.       case 4:    n0 = n1%n0;        break;
  466.       case 5:    n0 &= n1;        break;
  467.       case 6:    n0 |= n1;        break;
  468.       case 7:    n0 =  ~n0;        break;
  469.       case 8:    n0 = (n1 > n0);        break;
  470.       case 9:    n0 = (n1 < n0);        break;
  471.       case 10:    n0 = (n0 == n1);    break;
  472.       case 11:    n0 = !n0;        break;
  473.       case 12:    n1=n0;            break;
  474.       case 13:    t=n0; n0=n1; n1=t;    break;
  475.       case 14:                break;
  476.       case 15:    printf("In Commands Out\n");
  477.             for (temp=rpn; temp->str; temp++)
  478.                 printf(" %d %-10s%d\n",
  479.                 temp->parsin,temp->str,temp->parsout);
  480.             break;
  481.       default:    Errno=0;
  482.             n0=Atol(av[i]);
  483.             if (Errno) {
  484.                 fprintf(stderr, "Bad RPN cmd: %s\n",av[i]);
  485.                 return 20;
  486.                 }
  487.             break;
  488.       }
  489.     stack[sp]=n0;
  490.     stack[sp+1]=n1;
  491.     sp += rpn[j].parsout;
  492.     }
  493. if (ifflag) return (int)(stack[sp-1]);    /* called from if: return top value */
  494. for (i=sp-1;(int)i>=0;i--) printf("%ld\n", stack[i]); /* else print stack */
  495. return 0;
  496. }
  497.  
  498. do_path()
  499. {
  500. union {    long *lp; long ll; } l;
  501. BPTR lock;
  502. char buf[256];
  503.  
  504. puts("Current dir");
  505. l.lp = (long *) Mycli->cli_CommandDir;
  506. while (l.ll) {
  507.     l.ll <<= 2;
  508.     PathName(l.lp[1], buf, 256L);
  509.     puts(buf);
  510.     l.ll = *l.lp;
  511.     }
  512. puts("C:");
  513. return 0;
  514. }
  515.  
  516. do_pri()
  517. {
  518. int t, pri;
  519. struct Process *proc;
  520.  
  521. t=myatoi(av[1],0,20); if (Errno) return 20;
  522. pri=myatoi(av[2],-128,127); if (Errno) return 20;
  523. Forbid();
  524. proc=(t==0 ? Myprocess : FindCLI((long)t));
  525. if (proc==NULL) fprintf(stderr, "process not found\n");
  526.     else SetTaskPri(proc, (long)pri);
  527. Permit();
  528. return 0;
  529. }
  530.  
  531. do_strleft()
  532. {
  533. char buf[256];
  534. int n;
  535.  
  536. strcpy(buf,av[2]);
  537. n=myatoi(av[3],1,strlen(buf)); if (Errno) return 20;
  538. buf[n]='\0';
  539. set_var(LEVEL_SET, av[1], buf);
  540. return 0;
  541. }
  542.  
  543. do_strright()
  544. {
  545. char buf[256];
  546. int n;
  547.  
  548. strcpy(buf, av[2]);
  549. n=myatoi(av[3],1,strlen(buf)); if (Errno) return 20;
  550. set_var(LEVEL_SET, av[1], buf+strlen(buf)-n);
  551. return 0;
  552. }
  553.  
  554. do_strmid()
  555. {
  556. char buf[256];
  557. int n1, n2;
  558.  
  559. strcpy(buf, av[2]);
  560. n1=myatoi(av[3],1,strlen(buf))-1; if (Errno) return 20;
  561. if (ac>4) {
  562.     n2=myatoi(av[4],1,strlen(buf)-n1);
  563.     if (Errno) return 20;
  564.     buf[n1+n2]='\0';
  565.     }
  566. set_var(LEVEL_SET, av[1], buf+n1);
  567. return 0;
  568. }
  569.  
  570. do_strlen()
  571. {
  572. char buf[16];
  573.  
  574. sprintf(buf,"%d",strlen(av[2]));
  575. set_var(LEVEL_SET, av[1], buf);
  576. return 0;
  577. }
  578.  
  579. myatoi(s,min,max)
  580. char *s;
  581. {
  582. long n;
  583.  
  584. Errno=0;
  585. n=Atol(s);
  586. if (Errno==ERRBADINT) ierror(s,511);
  587.     else if (n<min || n>max) {
  588.         Errno=ERRBADINT;
  589.         printf("%s not in (%d,%d)\n",s,min,max);
  590.         }
  591. return (int)n;
  592. }
  593. SHAR_EOF
  594. cat << \SHAR_EOF > globals.c
  595.  
  596. /*
  597.  * GLOBALS.C
  598.  *
  599.  * (c)1986 Matthew Dillon     9 October 1986
  600.  *
  601.  * Version 2.07M by Steve Drew 10-Sep-87
  602.  *
  603.  *    Most global variables.
  604.  *
  605.  * Version 3.02A by Carlo Borreo & Cesare Dieni 20-Dec-88
  606.  *
  607.  */
  608.  
  609. char *v_titlebar="_titlebar";    /* Window title                */
  610. char *v_prompt    ="_prompt";    /* your prompt (ascii command)        */
  611. char *v_hist    ="_history";    /* set history depth (value)        */
  612. char *v_histnum    ="_histnum";    /* set history numbering var        */
  613. char *v_debug    ="_debug";    /* set debug mode            */
  614. char *v_verbose    ="_verbose";    /* set verbose for source files        */
  615. char *v_stat    ="_maxerr";    /* worst return value to date        */
  616. char *v_lasterr    ="_lasterr";    /* return value from last comm.        */
  617. char *v_cwd    ="_cwd";    /* current directory            */
  618. char *v_except    ="_except";    /* "nnn;command"            */
  619. char *v_passed    ="_passed";    /* passed arguments to source file    */
  620. char *v_path    ="_path";    /* search path for external commands    */
  621. char *v_gotofwd    ="_gtf";    /* set name for fwd goto name        */
  622.  
  623. struct HIST *H_head, *H_tail;    /* HISTORY lists */
  624.  
  625. struct PERROR Perror[]= {    /* error code->string */
  626.     103,    "Insufficient free storage",
  627.     105,    "Task table full",
  628.     120,    "Argument line invalid or too long",
  629.     121,    "File is not an object module",
  630.     122,    "Invalid resident library during load",
  631.     201,    "No default directory",
  632.     202,    "Object in use",
  633.     203,    "Object already exists",
  634.     204,    "Directory not found",
  635.     205,    "Object not found",
  636.     206,    "Bad stream name",
  637.     207,    "Object too large",
  638.     209,    "Action not known",
  639.     210,    "Invalid stream component name",
  640.     211,    "Invalid object lock",
  641.     212,    "Object not of required type",
  642.     213,    "Disk not validated",
  643.     214,    "Disk write protected",
  644.     215,    "Rename across devices",
  645.     216,    "Directory not empty",
  646.     217,    "Too many levels",
  647.     218,    "Device not mounted",
  648.     219,    "Seek error",
  649.     220,    "Comment too long",
  650.     221,    "Disk full",
  651.     222,    "File delete protected",
  652.     223,    "File write protected",
  653.     224,    "File read protected",
  654.     225,    "Not a DOS disk",
  655.     226,    "No disk",
  656.  
  657.  /* custom error messages */
  658.  
  659.     500,    "Bad arguments",
  660.     501,    "Label not found",
  661.     502,    "Must be within source file",
  662.     503,    "Syntax Error",
  663.     504,    "Redirection error",
  664.     505,    "Pipe error",
  665.     506,    "Too many arguments",
  666.     507,    "Destination not a directory",
  667.     508,    "Cannot mv a filesystem",
  668.     509,    "Error in command name",
  669.     510,    "Bad drive name",
  670.     511,    "Illegal number",
  671.     0,    NULL
  672. };
  673.  
  674. char *av[MAXAV];        /* Internal argument list        */
  675. long Src_base[MAXSRC];        /* file pointers for source files    */
  676. long Src_pos[MAXSRC];        /* seek position storage for same    */
  677. char If_base[MAXIF];        /* If/Else stack for conditionals    */
  678. int H_len, H_tail_base;        /* History associated stuff        */
  679. int H_stack;            /* AddHistory disable stack        */
  680. int E_stack;            /* Exception disable stack        */
  681. int Src_stack, If_stack;    /* Stack Indexes            */
  682. int forward_goto;        /* Flag for searching for foward lables    */
  683. int ac;                /* Internal argc            */
  684. int debug;            /* Debug mode                */
  685. int disable;            /* Disable com. execution (conditionals)*/
  686. int Verbose;            /* Verbose mode for source files    */
  687. int Lastresult;            /* Last return code            */
  688. int Exec_abortline;        /* flag to abort rest of line        */
  689. int Quit;            /* Quit flag                */
  690. long Cout, Cin;            /* Current input and output file handles*/
  691. long Cout_append;        /* append flag for Cout            */
  692. char *Cin_name, *Cout_name;    /* redirection input/output name or NULL*/
  693. char *Pipe1, *Pipe2;        /* the two pipe temp. files        */
  694. struct Process *Myprocess;
  695. struct CommandLineInterface *Mycli;
  696. int S_histlen = 20;        /* Max # history entries        */
  697. unsigned int options;
  698. SHAR_EOF
  699. cat << \SHAR_EOF > main.c
  700. /*
  701.  * MAIN.C
  702.  *
  703.  * Matthew Dillon, 24 Feb 1986
  704.  * (c)1986 Matthew Dillon     9 October 1986
  705.  *
  706.  * Version 2.07M by Steve Drew 10-Sep-87
  707.  *
  708.  * Version 3.02A by Carlo Borreo & Cesare Dieni 20-Dec-88
  709.  *
  710.  */
  711.  
  712. char *shellctr="CshCounter";
  713.  
  714. extern char *v_titlebar, *v_prompt, *v_hist, *v_lasterr, *v_path;
  715.  
  716. int aux; /* for use with aux: driver */
  717. char *oldtitle;
  718. char trueprompt[100];
  719. char Inline[260];
  720. struct IntuitionBase *IntuitionBase;
  721. struct Window *w;
  722. struct ArpBase *ArpBase;
  723.  
  724. main(argc, argv)
  725. register char *argv[];
  726. {
  727. #if RAW_CONSOLE
  728.     char *rawgets();
  729. #endif
  730.  
  731. register unsigned int i;
  732. extern int Enable_Abort;
  733. char buf[10];
  734.  
  735. ArpBase=(struct ArpBase *)OpenLibrary("arp.library",34L);
  736. if (ArpBase==NULL) { printf("No arp library\n"); exit(0); }
  737.  
  738. Forbid();
  739. i=Errno=0;
  740. if (Getenv(shellctr,buf,10L)) {
  741.     i=(int)(long)Atol(buf);
  742.     if (Errno) i=0;
  743.     }
  744. sprintf(buf,"%d",i+1);
  745. Setenv(shellctr,buf);
  746. Permit();
  747.  
  748. IntuitionBase=(struct IntuitionBase *)ArpBase->IntuiBase;
  749.  
  750. init();
  751.  
  752. sprintf(buf,"%ld",Myprocess->pr_TaskNum);
  753. set_var(LEVEL_SET, "_clinumber", buf);
  754.  
  755. oldtitle=(char *)(w->Title);
  756.  
  757. set_var(LEVEL_SET, v_titlebar, "CShell V3.02A");
  758. set_var(LEVEL_SET, v_prompt,
  759.     (IsInteractive(Input())) ? "\23337m%p> \2330m" : "");
  760. set_var(LEVEL_SET, v_hist, "20");
  761. set_var(LEVEL_SET, v_lasterr, "0");
  762. set_var(LEVEL_SET, v_path, "RAM:,RAM:c/,df0:c/,df1:c/,sys:system/");
  763. set_var(LEVEL_SET, "_insert", "1");
  764. set_var(LEVEL_SET, "f1", "cdir df0:\15");
  765. set_var(LEVEL_SET, "F1", "cdir df1:\15");
  766. set_var(LEVEL_SET, "f3", "cdir RAM:\15");
  767. set_var(LEVEL_SET, "F3", "cdir vd0:\15");
  768. set_var(LEVEL_SET, "f4", "cd df0:\15");
  769. set_var(LEVEL_SET, "F4", "cd df1:\15");
  770. set_var(LEVEL_SET, "f5", "cls; ls\15");
  771. set_var(LEVEL_SET, "F5", "cdir ");
  772. set_var(LEVEL_SET, "f6", "lc\15");
  773. set_var(LEVEL_SET, "f7", "info\15");
  774. set_var(LEVEL_SET, "F7", "assign \15");
  775. set_var(LEVEL_SET, "f8", "window -lf\15");
  776. set_var(LEVEL_SET, "F8", "window -sb\15");
  777. set_var(LEVEL_SET, "f10", "cls\15");
  778. set_var(LEVEL_SET, "F10", "exit\15");
  779. set_var(LEVEL_ALIAS, "cls", "echo -n ^l");
  780. set_var(LEVEL_ALIAS, "lc", "ls -s");
  781. set_var(LEVEL_ALIAS, "kr", "rm -r RAM:* >NIL:");
  782. set_var(LEVEL_ALIAS, "cdir", "%q cd $q; cls; dir");
  783. set_var(LEVEL_ALIAS, "exit", "endcli;quit");
  784. set_var(LEVEL_ALIAS, "lp", "cat >PRT:");
  785. seterr();
  786. do_pwd(NULL); /* set $_cwd */
  787. Enable_Abort = 0;
  788. for (i = 1; i < argc; ++i) {
  789.     if (!strcmp(argv[i],"-c")) {
  790.         Inline[0] = ' ';
  791.         Inline[1] = '\0';
  792.         while (++i < argc)
  793.             { strcat(Inline,argv[i]); strcat(Inline," "); }
  794.         exec_command(Inline);
  795.         main_exit(Lastresult);
  796.         }
  797.     if (!strcmp(argv[i],"-a")) { aux = 1; continue; }
  798.     sprintf (Inline, "source %s",argv[i]);
  799.     av[1] = argv[i];
  800.     do_source (Inline);
  801.     }
  802. for (;;) {
  803.    if (breakcheck())
  804.     while (WaitForChar(Input(), 100L) || stdin->_bp < stdin->_bend)
  805.         gets(Inline);
  806.    clearerr(stdin);  /* prevent acidental quit */
  807. #if RAW_CONSOLE
  808.    if (Quit || !rawgets(Inline, disable ? "_ " : trueprompt)) main_exit(0);
  809. #else
  810.    printf("%s", disable ? "_ " : trueprompt);
  811.    fflush(stdout);
  812.    if (Quit || !gets(Inline)) main_exit(0);
  813. #endif
  814.    breakreset();
  815.    if (*Inline) exec_command(Inline);
  816.    }
  817. }
  818.  
  819. main_exit(n)
  820. {
  821. register unsigned short i;
  822. char buf[10];
  823.  
  824. Getenv(shellctr,buf,10L);
  825. i=(int)Atol(buf);
  826. sprintf(buf,"%d",i-1);
  827. Setenv(shellctr,buf);
  828. SetWindowTitles(w,oldtitle,-1L);
  829. for (i=1; i<MAXMYFILES; i++) myclose(i);
  830. ArpExit(0L,0L);            /* Intuition need not to be closed */
  831. }
  832.  
  833. init()
  834. {
  835. static char pipe1[32], pipe2[32];
  836. struct Window *getwindow();
  837.  
  838. stdin->_flags    |= 0x80;    /* make sure we're set as a tty */
  839. stdout->_flags    |= 0x80;    /* in case of redirection in .login */
  840. Close(_devtab[2].fd);
  841. _devtab[2].mode |= O_STDIO;
  842. _devtab[2].fd = _devtab[1].fd;    /* set stderr to Output() otherwise */
  843.                 /* don't work with aux driver */
  844. Myprocess = (struct Process *)FindTask(0L);
  845. Mycli=(struct CommandLineInterface *)((long)Myprocess->pr_CLI << 2);
  846. w=getwindow();
  847. Pipe1 = pipe1;
  848. Pipe2 = pipe2;
  849. sprintf(pipe1, "ram:pipe1_%ld", Myprocess);
  850. sprintf(pipe2, "ram:pipe2_%ld", Myprocess);
  851. }
  852.  
  853. breakcheck()
  854. {
  855. return (int)(SetSignal(0L,0L) & SIGBREAKF_CTRL_C);
  856. }
  857.  
  858. breakreset()
  859. {
  860. SetSignal(0L, SIGBREAKF_CTRL_C);
  861. }
  862.  
  863. dobreak()
  864. {
  865. if (breakcheck()) { printf("^C\n"); return(1); }
  866. return(0);
  867. }
  868.  
  869. /* this routine causes manx to use this Chk_Abort() rather than it's own */
  870. /* otherwise it resets our ^C when doing any I/O (even when Enable_Abort */
  871. /* is zero).  Since we want to check for our own ^C's             */
  872.  
  873. Chk_Abort()
  874. {
  875. return(0);
  876. }
  877.  
  878. _wb_parse()
  879. {
  880. }
  881.  
  882. do_howmany()
  883. {
  884. char buf[10];
  885.  
  886. Getenv(shellctr, buf, 10L);
  887. printf("Shell(s) running: %s\n",buf);
  888. }
  889.  
  890. struct Window *getwindow()
  891. {
  892. struct InfoData *infodata;
  893. struct Window *win;
  894. long args[8];
  895.  
  896. infodata=AllocMem((long)sizeof(struct InfoData),MEMF_CLEAR | MEMF_PUBLIC);
  897. args[0]=(long)infodata >> 2;
  898. SendPacket(ACTION_DISK_INFO,args,Myprocess->pr_ConsoleTask);
  899. win=(struct Window *)infodata->id_VolumeNode;
  900. FreeMem(infodata,(long)sizeof(struct InfoData));
  901. return win;
  902. }
  903. SHAR_EOF
  904. cat << \SHAR_EOF > makefile
  905. ######################################################################
  906. #
  907. # Makefile to build Shell 3.02A
  908. # by Carlo Borreo & Cesare Dieni 20-Dec-88
  909. #
  910. ######################################################################
  911.  
  912. OBJS    = run.o main.o comm1.o comm2.o comm3.o execom.o set.o sub.o \
  913.       globals.o rawconsole.o
  914.  
  915. INCL    = shell.h
  916.  
  917. Shell   : Shell.syms $(OBJS)
  918.     ln  +q -m -o Shell $(OBJS) -la -lc
  919.  
  920. Shell.syms : $(INCL)
  921.     cc +HShell.syms shell.h
  922.  
  923. rawconsole.o : rawconsole.c $(INCL)
  924.     cc +IShell.syms rawconsole.c
  925.  
  926. run.o   : run.c $(INCL)
  927.     cc +IShell.syms run.c
  928.  
  929. main.o  : main.c $(INCL)
  930.     cc +IShell.syms main.c
  931.  
  932. comm1.o : comm1.c $(INCL)
  933.     cc +IShell.syms comm1.c
  934.  
  935. comm2.o : comm2.c $(INCL)
  936.     cc +IShell.syms comm2.c
  937.  
  938. comm3.o : comm3.c $(INCL)
  939.     cc +IShell.syms comm3.c
  940.  
  941. set.o   : set.c $(INCL)
  942.     cc +IShell.syms set.c
  943.  
  944. sub.o   : sub.c $(INCL)
  945.     cc +IShell.syms sub.c
  946.  
  947. globals.o : globals.c $(INCL)
  948.     cc +IShell.syms globals.c
  949.  
  950. execom.o : execom.c $(INCL)
  951.     cc +IShell.syms execom.c
  952. SHAR_EOF
  953. cat << \SHAR_EOF > rawconsole.c
  954. /*
  955.  * RawConsole.c
  956.  *
  957.  * Shell 2.07M  17-Jun-87
  958.  * console handling, command line editing support for Shell
  959.  * using new console packets from 1.2.
  960.  * Written by Steve Drew. (c) 14-Oct-86.
  961.  * 16-Dec-86 Slight mods to rawgets() for Disktrashing.
  962.  *
  963.  * Version 3.02A by Carlo Borreo & Cesare Dieni 20-Dec-88
  964.  *
  965.  */
  966.  
  967. char *tyahdptr;
  968.  
  969. myget()
  970. {
  971. if (*tyahdptr) return *tyahdptr++;
  972. return getchar();
  973. }
  974.  
  975. #if RAW_CONSOLE
  976. extern int aux; /* for use with aux: */
  977.  
  978. #define SETRAW setrawcon(-1L);
  979. #define SETCON setrawcon(0L);
  980.  
  981. int width;
  982.  
  983. newwidth()
  984. {
  985. extern struct Window *w;
  986.  
  987. width=(w->Width- (w->BorderLeft + w->BorderRight)) / w->RPort->TxWidth;
  988. }
  989.  
  990. char *rawgets(line,prompt)
  991. char *line, *prompt;
  992. {
  993. char *get_var();
  994. char *gets();
  995. register int n, pl;
  996. register int max, i;
  997. unsigned char c1,c2,c3;
  998. char fkeys[5];
  999. char *s;
  1000. char *ps;
  1001. char typeahd[256];
  1002. int fkey, savn;
  1003. int insert = 1;
  1004. char rep[20];
  1005. int recall = -1;
  1006. struct HIST *hist;
  1007.  
  1008. newwidth();
  1009.  
  1010. if (aux) {
  1011.     printf("%s",prompt);
  1012.     fflush(stdout);
  1013.     }
  1014. if (!IsInteractive(Input()) || aux ) return(gets(line));
  1015. if (WaitForChar((long)Input(), 100L) ||   /* don't switch to 1L ...*/
  1016.         stdin->_bp < stdin->_bend) {     /* else causes read err's*/
  1017.     gets(line);
  1018.     return(line);
  1019.     }
  1020. SETRAW;
  1021. printf("\015%s\2336n",prompt);
  1022. savn = pl = n = 0;
  1023. tyahdptr = typeahd;
  1024. while((typeahd[n]=getchar()) != 'R') {
  1025.     if ((unsigned char)typeahd[n] == 155) savn = n;
  1026.     n++;
  1027.     }
  1028.     /* typeahd now contains possible type a head chars
  1029.        followed by <CSI> cursor position report.
  1030.     */
  1031. typeahd[savn]  = '\0';
  1032. if (typeahd[n-2] != ';') pl = (typeahd[n-2] - 48) * 10;
  1033. pl += typeahd[n-1] - 49;
  1034. ps = line + pl;
  1035. line[max = i = pl] = '\0';
  1036.  
  1037. if (s = get_var (LEVEL_SET, "_insert")) insert = atoi(s) ? 1 : 0;
  1038.  
  1039. while( (c1 = myget()) != 255) {
  1040.         switch(c1) {
  1041.             case 155:
  1042.                  c2 = myget();
  1043.                  switch(c2) {
  1044.                      case 'A':                  /* up arrow   */
  1045.                         n = ++recall;
  1046.                      case 'B':                  /* down arrow */
  1047.                         line[pl] = '\0';
  1048.                         if (recall >= 0 || c2 == 'A') {
  1049.                             if (c2 == 'B') n = --recall;
  1050.                             if (recall >= 0) {
  1051.                                 for(hist = H_head; hist && n--;
  1052.                                     hist = hist->next);
  1053.                                 if (hist) strcpy(&line[pl],hist->line);
  1054.                                 else recall = H_len;
  1055.                             }
  1056.                         }
  1057.                         if (i != pl)
  1058.                             printf("\233%dD",i);
  1059.                         printf("\015\233J%s%s",prompt,ps);
  1060.                         i = max = strlen(ps) + pl;
  1061.                         break;
  1062.                      case 'C':                  /* right arrow*/
  1063.                         if (i < max) {
  1064.                             i++;
  1065.                             printf("\233C");
  1066.                         }
  1067.                         break;
  1068.                      case 'D':                  /* left arrow */
  1069.                         if (i > pl) {
  1070.                             i--;
  1071.                             printf("\233D");
  1072.                         }
  1073.                         break;
  1074.                      case 'T':           /* shift-up   */
  1075.                        n = recall = H_len-1;
  1076.                      case 'S':           /* shift-down */
  1077.                        line[pl] = '\0';
  1078.                        if (c2 == 'S') {
  1079.                            n = recall = 0;
  1080.                            if (H_head) strcpy(&line[pl], H_head->line);
  1081.                        }
  1082.                        else if (H_tail) strcpy(&line[pl], H_tail->line);
  1083.                        printf("\015\233J%s%s",prompt,ps);
  1084.                        i = max = strlen(ps) + pl;
  1085.                        break;
  1086.                     case ' ':                   /* shift -> <-*/
  1087.                         c3 = myget();
  1088.                                      switch(c3) {
  1089.                     case('@'):      /* shift ->   */
  1090.                         while (ps[i-strlen(prompt)] == ' ' && i<max) {
  1091.                             i++;
  1092.                             printf("\233C");
  1093.                         }
  1094.                         while (ps[i-strlen(prompt)] != ' ' && i<max) {
  1095.                             i++;
  1096.                             printf("\233C");
  1097.                         }
  1098.                         break;
  1099.                     case('A'):      /* shift <-   */
  1100.                         while (ps[i-strlen(prompt)-1] == ' ' && i>pl) {
  1101.                             i--;
  1102.                             printf("\233D");
  1103.                         }
  1104.                         while (ps[i-strlen(prompt)-1] != ' ' && i>pl) {
  1105.                             i--;
  1106.                             printf("\233D");
  1107.                         }
  1108.                         break;
  1109.                         default:
  1110.                         break;
  1111.                     }
  1112.                         break;
  1113.                     default:
  1114.                         c3 = myget();
  1115.                         if (c3 == '~') {
  1116.                             fkey = c2;
  1117.                             fkeys[0] = 'f';
  1118.                             if (c2 == '?') {
  1119.                                 strcpy(ps,"help");
  1120.                                 goto done;
  1121.                             }
  1122.                         }
  1123.                         else if (myget() != '~') { /* window was resized */
  1124.                             while(myget() != '|');
  1125.                             newwidth();
  1126.                             break;
  1127.                         }
  1128.                         else {
  1129.                             fkey = c3;
  1130.                             fkeys[0] = 'F';
  1131.                         }
  1132.                         sprintf(fkeys+1,"%d",fkey - 47);
  1133.                         if (s = get_var(LEVEL_SET, fkeys))
  1134.                                 tyahdptr = strcpy(typeahd,s);
  1135.                         break;
  1136.                     }
  1137.                 break;
  1138.             case 8:
  1139.                 if (i > pl) {
  1140.                     i--;
  1141.                     printf("\010");
  1142.                 }
  1143.                 else break;
  1144.             case 127:
  1145.                 if (i < max) {
  1146.                     int j,t,l = 0;
  1147.                     movmem(&line[i+1],&line[i],max-i);
  1148.                     --max;
  1149.                     printf("\233P");
  1150.                     j = width - i % width - 1;   /* amount to end     */
  1151.                     t = max/width - i/width;     /* no of lines       */
  1152.                     for(n = 0; n < t; n++) {
  1153.                         l += j;                  /* no. of char moved */
  1154.                         if (j) printf("\233%dC",j); /* goto eol       */
  1155.                         printf("%c\233P",line[width*(i/width+n+1)-1]);
  1156.                         j = width-1;
  1157.                     }
  1158.                     if (t)
  1159.                     printf("\233%dD",l+t);   /* get back */
  1160.                 }
  1161.                 break;
  1162.             case 18:
  1163.                 n = i/width;
  1164.                 if (n) printf("\233%dF",n);
  1165.                 printf("\015\233J%s%s",prompt,ps);
  1166.                 i = max;
  1167.                 break;
  1168.             case 27:
  1169.                 break;
  1170.             case 1:
  1171.                 insert ^= 1;
  1172.                 break;
  1173.             case 21:
  1174.             case 24:
  1175.             case 26:
  1176.                 if (i>pl) printf("\233%dD",i-pl);
  1177.                 i = pl;
  1178.                 if (c1 == 26) break;
  1179.             case 11:        /* ^K */
  1180.                 printf("\233J");
  1181.                 max = i;
  1182.                 line[i] = '\0';
  1183.                 break;
  1184.             case 28:        /* ^\ */
  1185.                 SETCON;
  1186.                 return(NULL);
  1187.             case 5:
  1188.                 if (i!=max) printf("\233%dC",max - i);
  1189.                 i = max;
  1190.                 break;
  1191.             case 10:
  1192.             case 13:
  1193.                 line[max] = '\0';
  1194. done:           printf("\233%dC\n",max - i);
  1195.  
  1196.                 SETCON;
  1197.                 strcpy(line, ps);
  1198.                 return(line);
  1199.             default:
  1200.                 c1 &= 0x7f;
  1201.                 if (c1 == 9) c1 = 32;
  1202.                 if (c1 > 31 & i < 256) {
  1203.                     if (i < max && insert) {
  1204.                         int j,t,l = 0;
  1205.                         movmem(&line[i], &line[i+1], max - i);
  1206.                         printf("\233@%c",c1);
  1207.                         t = max/width - i/width;
  1208.                         j = width - i % width - 1;
  1209.                         for(n = 0; n < t; n++) {
  1210.                             l += j;
  1211.                             if (j) printf("\233%dC",j);
  1212.                             printf("\233@%c",line[width*(i/width+n+1)]);
  1213.                             j = width-1;
  1214.                         }
  1215.                         if (t) printf("\233%dD",l + t);
  1216.                         ++max;
  1217.                     }
  1218.                     else {
  1219.                         if(i == pl && max == i) printf("\015%s%s",prompt,ps);
  1220.                         putchar(c1);
  1221.                     }
  1222.                     line[i++] = c1;
  1223.                     if (max < i) max = i;
  1224.                     line[max] = '\0';
  1225.                 }
  1226.         }
  1227.     }
  1228. SETCON;
  1229. return(NULL);
  1230. }
  1231.  
  1232. setrawcon(flag) /* -1L=RAW:, 0L=CON: */
  1233. long flag;
  1234. {
  1235. long packargs[8];
  1236.  
  1237. packargs[0]=flag;
  1238. SendPacket(994L, packargs, Myprocess->pr_ConsoleTask);
  1239. }
  1240.  
  1241. #endif
  1242. SHAR_EOF
  1243. cat << \SHAR_EOF > run.c
  1244.  
  1245. /*
  1246.  * RUN.C
  1247.  *
  1248.  * (c)1986 Matthew Dillon     9 October 1986
  1249.  *
  1250.  *    RUN   handles running of external commands.
  1251.  *
  1252.  * Version 2.07M by Steve Drew 10-Sep-87
  1253.  *
  1254.  * Version 3.02A by Carlo Borreo & Cesare Dieni 20-Dec-88
  1255.  *
  1256.  */
  1257.  
  1258. extern char *v_path;
  1259. char *FindIt();
  1260.  
  1261. do_run(str)
  1262. char *str;
  1263. {
  1264. int i, len, retcode;
  1265. char buf[200]; /* enough space for 100 char cmd name + path stuff */
  1266. char *path;
  1267.  
  1268. char *p = av[0];
  1269. char **args = av+1;
  1270.  
  1271. while(*p++) *p &= 0x7F;      /* allow "com mand" */
  1272.  
  1273. while(*args) {                /* if any arg contains a space then */
  1274.     if (index(*args,' ')) {        /* surround with quotes, since must */
  1275.     i = strlen(*args);        /* of specified via "arg u ment" on */
  1276.     movmem(*args,(*args)+1,i);    /* original command line.        */
  1277.     args[0][0] = args[0][i+1] = '\"';    /* mpush in execom.c has    */
  1278.     args[0][i+2] = '\0';        /* allowed for these 2 extra bytes. */
  1279.     }
  1280.     ++args;
  1281.     }
  1282. if ((len = strlen(av[0])) > 100) { ierror(NULL,509); return -1; }
  1283. if (path = FindIt(av[0],"",buf)) retcode = myfexecv(path, av);
  1284. else {
  1285.     Myprocess->pr_WindowPtr = (APTR)(-1);
  1286.     /*
  1287.      * manx's fexecv code only allows us 38
  1288.      * chars for command name.
  1289.      */
  1290.     if (len > 37) av[0][37] = '\0';
  1291.     retcode = myfexecv(av[0], av);
  1292.     Myprocess->pr_WindowPtr = NULL;
  1293.     }
  1294. if (retcode < 0) {
  1295.     char *copy;
  1296.     if ((path = FindIt(av[0],".sh",buf)) == NULL) {
  1297.         fprintf(stderr,"Command Not Found %s\n",av[0]);
  1298.         return -1;
  1299.         }
  1300.     av[1] = buf;               /* particular to do_source() */
  1301.     copy = malloc(strlen(str)+3);
  1302.     sprintf(copy,"x %s",str);
  1303.     retcode = do_source(copy);
  1304.     free(copy);
  1305.     }
  1306. return retcode;
  1307. }
  1308.  
  1309. char *dofind(cmd, ext, buf)
  1310. char *cmd, *ext, *buf;
  1311. {
  1312. char *ptr, *s;
  1313.  
  1314. sprintf(buf,"%s%s",cmd,ext);
  1315. if (exists(buf)) return buf;
  1316. if (BaseName(buf)==buf) {
  1317.     s = get_var(LEVEL_SET, v_path);
  1318.     while (*s) {
  1319.         for (ptr=buf; *s && *s!=','; ) *ptr++ = *s++;
  1320.         sprintf(ptr, "%s%s", cmd, ext);
  1321.         if (exists(buf)) return buf;
  1322.         if (*s) s++;
  1323.         }
  1324.     }
  1325. return NULL;
  1326. }
  1327.  
  1328. char *FindIt(cmd,ext,buf)
  1329. char *cmd, *ext, *buf;
  1330. {
  1331. char *response;
  1332.  
  1333. Myprocess->pr_WindowPtr = (APTR)(-1);
  1334. response=dofind(cmd,ext,buf);
  1335. Myprocess->pr_WindowPtr = NULL;
  1336. return response;
  1337. }
  1338.  
  1339. myfexecv(cmd, argv)
  1340. char *cmd, **argv;
  1341. {
  1342. long ret_val;
  1343. struct FileHandle *fhp;
  1344. APTR sav_ret;
  1345. register char **ap, *cp, *arg;
  1346. int i;
  1347. long len, seg, sav, stksiz;
  1348. char buf[40];
  1349. union {
  1350.     long *lp;
  1351.     long ll;
  1352.     } l, stk;
  1353. long oldcin, oldcout;
  1354. long doexec();
  1355. extern long _savsp;
  1356.  
  1357. if (seg = LoadPrg(cmd)) goto found;
  1358. l.lp = (long *) Mycli->cli_CommandDir;
  1359. while (l.ll) {
  1360.     l.ll <<= 2;
  1361.     sav = CurrentDir(l.lp[1]);
  1362.     seg = LoadPrg(cmd);
  1363.     CurrentDir(sav);
  1364.     if (seg) goto found;
  1365.     l.ll = *l.lp;
  1366.     }
  1367. sprintf(buf, "c:%s", cmd);
  1368. if (seg = LoadPrg(buf)) goto found;
  1369. return -1;
  1370.  
  1371. found:
  1372.  
  1373. stksiz = 4 * Mycli->cli_DefaultStack;
  1374. if ((stk.lp = AllocMem(stksiz+8, 0L)) == 0) {
  1375.     UnLoadPrg(seg);
  1376.     return -1;
  1377.     }
  1378. for (len=0,ap=argv+1;*ap;ap++)
  1379.     len += strlen(*ap) + 1;
  1380. if (len==0) len++;
  1381. if ((cp = arg = AllocMem(len, 0L)) == 0) {
  1382.     UnLoadPrg(seg);
  1383.     FreeMem(stk.lp, stksiz+8);
  1384.     return -1;
  1385.     }
  1386. *stk.lp = stksiz + 8;
  1387. stk.ll += stksiz;
  1388. stk.lp[0] = stksiz;
  1389. stk.lp[1] = ((long *)_savsp)[2];
  1390. sav_ret = Myprocess->pr_ReturnAddr;
  1391. Myprocess->pr_ReturnAddr = (APTR) stk.lp;
  1392.  
  1393. sav = Mycli->cli_Module;
  1394. Mycli->cli_Module = seg;
  1395.  
  1396. for (ap=argv+1;*ap;ap++) {
  1397.     strcpy(cp, *ap);
  1398.     if (ap[1]) strcat(cp, " ");
  1399.     cp += strlen(cp);
  1400.     }
  1401. if (len==1) arg[1]='\0';
  1402. arg[len-1] = '\n';
  1403.  
  1404. cp = (char *)((long)Mycli->cli_CommandName << 2);
  1405. movmem(cp, buf, 40);
  1406. strcpy(cp+1, cmd);
  1407. cp[0] = strlen(cmd);
  1408.  
  1409. fhp = (struct FileHandle *) (Myprocess->pr_CIS << 2);
  1410. strncpy(fhp->fh_Buf<<2, arg, (int)(len < 200?len:199));
  1411. fhp->fh_Pos = 0;
  1412. fhp->fh_End = len < 200?len:199;
  1413. oldcin  = Myprocess->pr_CIS;
  1414. oldcout = Myprocess->pr_COS;
  1415.  
  1416. ret_val = doexec(len, stksiz, stksiz+8, len, arg, (seg+1)<<2, stk.ll);
  1417.  
  1418. Myprocess->pr_CIS = oldcin;
  1419. Myprocess->pr_COS = oldcout;
  1420. fhp->fh_Pos = fhp->fh_End;
  1421. UnLoadPrg(Mycli->cli_Module);
  1422. Myprocess->pr_ReturnAddr = sav_ret;
  1423. Mycli->cli_Module = sav;
  1424. FreeMem(arg, len);
  1425. movmem(buf, cp, 40);
  1426. return ret_val;
  1427. }
  1428.  
  1429. static long doexec()
  1430. {
  1431. #asm
  1432.     movem.l    d3-d7/a2-a5,-(sp)        ;save registers
  1433.     lea        savsp(pc),a0
  1434.     move.l    sp,(a0)                    ;save our sp
  1435.     movem.l    8(a5),d0/d2/d3/d4/a0/a4/a7    ;load params
  1436.     move.l    4(sp),a3                ;get old sp from CLI
  1437.     movem.l    4(a3),a1/a2/a5/a6        ;get BCPL environment
  1438.     move.l    d0,12(a1)                ;set length
  1439.     move.l    a0,d1                    ;copy to dreg
  1440.     lsr.l    #2,d1                    ;convert to BPTR
  1441.     move.l    d1,8(a1)                ;set ptr
  1442.     move.l    a0,d1                    ;copy to d1 as well
  1443.     jsr        (a4)                    ;call new program
  1444.     movem.l    (sp)+,d2/d3                ;get stk siz and old sp
  1445.     move.l    sp,a1                    ;save current sp
  1446.     move.l    savsp(pc),sp            ;get back our sp
  1447.     movem.l    (sp)+,d3-d7/a2-a5        ;get back registers
  1448.     move.l    d0,-(sp)                ;save return code
  1449.     sub.l    d2,a1                    ;back up a bit
  1450.     sub.l    #8,a1                    ;back up over header
  1451.     move.l    (a1),d0                    ;get size to free
  1452.     move.l    4,a6                    ;get ExecBase
  1453.     jsr        -210(a6)                ;free the memory
  1454.     move.l    (sp)+,d0                ;get the return code
  1455. #endasm
  1456. }
  1457.  
  1458. #asm
  1459. savsp:
  1460.     dc.l    0
  1461. #endasm
  1462. SHAR_EOF
  1463. cat << \SHAR_EOF > set.c
  1464.  
  1465. /*
  1466.  * SET.C
  1467.  *
  1468.  * (c)1986 Matthew Dillon     9 October 1986
  1469.  *
  1470.  * Version 2.07M by Steve Drew 10-Sep-87
  1471.  *
  1472.  * Version 3.02A by Carlo Borreo & Cesare Dieni 20-Dec-88
  1473.  *
  1474.  */
  1475.  
  1476. extern char *v_titlebar, *v_verbose, *v_hist, *v_debug, *v_prompt;
  1477. extern struct Window *w;
  1478.  
  1479. #define MAXLEVELS (3 + MAXSRC)
  1480.  
  1481. struct MASTER {
  1482.     struct MASTER *next;
  1483.     struct MASTER *last;
  1484.     char *name;
  1485.     char *text;
  1486. };
  1487.  
  1488. static struct MASTER *Mbase[MAXLEVELS];
  1489.  
  1490. char *set_var(level, name, str)
  1491. register char *name, *str;
  1492. {
  1493.    register struct MASTER *base = Mbase[level];
  1494.    register struct MASTER *last;
  1495.    register int len;
  1496.  
  1497.    for (len = 0; isalphanum(name[len]); ++len);
  1498.    while (base != NULL) {
  1499.       if (strlen(base->name) == len && strncmp (name, base->name, len) == 0) {
  1500.          Free (base->text);
  1501.          goto gotit;
  1502.       }
  1503.       last = base;
  1504.       base = base->next;
  1505.    }
  1506.    if (base == Mbase[level]) {
  1507.       base = Mbase[level] = (struct MASTER *)malloc (sizeof(struct MASTER));
  1508.       base->last = NULL;
  1509.    } else {
  1510.       base = (struct MASTER *)malloc (sizeof(struct MASTER));
  1511.       base->last = last;
  1512.       last->next = base;
  1513.    }
  1514.    base->name = malloc (len + 1);
  1515.    bmov (name, base->name, len);
  1516.    base->name[len] = 0;
  1517.    base->next = NULL;
  1518. gotit:
  1519.    base->text = malloc (strlen(str) + 1);
  1520.    strcpy (base->text, str);
  1521.    if (*name=='_') sys_vars();
  1522.    return (base->text);
  1523. }
  1524.  
  1525. char *get_var (level, name)
  1526. register char *name;
  1527. {
  1528.    register struct MASTER *base = Mbase[level];
  1529.    register unsigned char *scr;
  1530.    register int len;
  1531.  
  1532.    for (scr = (unsigned char *)name; *scr && *scr != 0x80 && *scr != ' ' && *scr != ';' && *scr != '|'; ++scr);
  1533.    len = scr - name;
  1534.  
  1535.    while (base != NULL) {
  1536.       if (strlen(base->name) == len && strncmp (name, base->name, len) == 0)
  1537.          return (base->text);
  1538.       base = base->next;
  1539.    }
  1540.    return (NULL);
  1541. }
  1542.  
  1543. unset_level(level)
  1544. {
  1545.    register struct MASTER *base = Mbase[level];
  1546.  
  1547.    while (base) {
  1548.       Free (base->name);
  1549.       Free (base->text);
  1550.       Free (base);
  1551.       base = base->next;
  1552.    }
  1553.    Mbase[level] = NULL;
  1554. }
  1555.  
  1556. unset_var(level, name)
  1557. char *name;
  1558. {
  1559.    register struct MASTER *base = Mbase[level];
  1560.    register struct MASTER *last = NULL;
  1561.    register int len;
  1562.  
  1563.    for (len = 0; isalphanum(name[len]); ++len);
  1564.    while (base) {
  1565.       if (strlen(base->name) == len && strncmp (name, base->name, len) == 0) {
  1566.          if (base != Mbase[level])
  1567.             last->next = base->next;
  1568.          else
  1569.             Mbase[level] = base->next;
  1570.          if (base->next != NULL)
  1571.             base->next->last = last;
  1572.          if (base == Mbase[level])
  1573.             Mbase[level] = base->next;
  1574.          Free (base->name);
  1575.          Free (base->text);
  1576.          Free (base);
  1577.          return (1);
  1578.       }
  1579.       last = base;
  1580.       base = base->next;
  1581.    }
  1582.    return (-1);
  1583. }
  1584.  
  1585. do_unset_var(str, level)
  1586. char *str;
  1587. {
  1588. register unsigned int i;
  1589.  
  1590. for (i = 1; i < ac; ++i) unset_var (level, av[i]);
  1591. sys_vars();
  1592. return 0;
  1593. }
  1594.  
  1595. do_set_var(command, level)
  1596. char *command;
  1597. {
  1598. register struct MASTER *base = Mbase[level];
  1599. register char *str;
  1600.  
  1601. switch (ac) {
  1602. case 1:
  1603.     while (base && !dobreak()) {
  1604.         printf ("\2330m%-10s %s\n", base->name, base->text);
  1605.         base = base->next;
  1606.         }
  1607.     break;
  1608. case 2:
  1609.     if (str=get_var(level,av[1])) printf ("%-10s %s\n", av[1], str);
  1610.     break;
  1611. default:
  1612.     set_var (level, av[1], next_word (next_word (command)));
  1613.     if (*av[1]=='_') sys_vars();
  1614.     break;
  1615.     }
  1616. return 0;
  1617. }
  1618.  
  1619. extern char trueprompt[100];
  1620.  
  1621. sys_vars()
  1622. {
  1623. register char *str, *t;
  1624.  
  1625. if (strcmp(w->Title, str=get_var(LEVEL_SET, v_titlebar)))
  1626.     SetWindowTitles(w, str, -1L);
  1627. S_histlen=(str = get_var(LEVEL_SET, v_hist)) ? atoi(str) : 0;
  1628. debug  =(get_var(LEVEL_SET, v_debug)  !=NULL);
  1629. Verbose=(get_var(LEVEL_SET, v_verbose)!=NULL);
  1630. if (S_histlen < 2) S_histlen=2;
  1631.  
  1632. if ( (str=get_var(LEVEL_SET,v_prompt)) ==NULL) str="$ ";
  1633. t=trueprompt;
  1634. while (*str)
  1635.     if (*str=='%' && Toupper(str[1])=='P') {
  1636.         str+=2;
  1637.         strcpy(t,get_var(LEVEL_SET,"_cwd"));
  1638.         t+=strlen(t);
  1639.         }
  1640.     else *t++=*str++;
  1641. strcpy(t,"\2330m");
  1642. }
  1643. SHAR_EOF
  1644. cat << \SHAR_EOF > shell.h
  1645.  
  1646. /*
  1647.  * SHELL.H
  1648.  *
  1649.  * (c)1986 Matthew Dillon     9 October 1986
  1650.  *
  1651.  *
  1652.  * SHELL include file.. contains shell parameters and extern's
  1653.  *
  1654.  * Version 2.07M by Steve Drew 10-Sep-87
  1655.  *
  1656.  * Version 3.02A by Carlo Borreo & Cesare Dieni 20-Dec-88
  1657.  *
  1658.  */
  1659.  
  1660. #define RAW_CONSOLE 1   /* Set to 0 to compile out Cmd Line Editing */
  1661.  
  1662. #include <stdio.h>
  1663. #include <exec/exec.h>
  1664. #include <time.h>
  1665. #include <libraries/dos.h>
  1666. #include <libraries/dosextens.h>
  1667. #include <intuition/intuition.h>
  1668. #include <intuition/intuitionbase.h>
  1669. #include "shellfunctions.h"
  1670. #include <fcntl.h>
  1671. #include <libraries/arpbase.h>
  1672. #include <arpfunctions.h>
  1673.  
  1674. typedef struct FileInfoBlock FIB;
  1675.  
  1676. #define bmov movmem
  1677.  
  1678. #define MAXAV        256        /* Max. # arguments        */
  1679. #define MAXSRC        5        /* Max. # of source file levels */
  1680. #define MAXIF        10        /* Max. # of if levels        */
  1681. #define MAXALIAS    20        /* Max. # of alias levels    */
  1682. #define MAXMYFILES    9        /* Max. # of internal files    */
  1683.  
  1684. #define LEVEL_SET    0        /* which variable list to use   */
  1685. #define LEVEL_ALIAS    1
  1686. #define LEVEL_LABEL    2
  1687.  
  1688.     /* EXECOM.C defines */
  1689.  
  1690. #define FL_DOLLAR    0x01  /* One of the following */
  1691. #define FL_BANG        0x02
  1692. #define FL_PERCENT    0x04
  1693. #define FL_QUOTE    0x08
  1694. #define FL_IDOLLAR    0x10  /* Any or all of the following may be set */
  1695. #define FL_EOC        0x20
  1696. #define FL_EOL        0x40
  1697. #define FL_OVERIDE    0x80
  1698. #define FL_WILD        0x100
  1699. #define FL_MASK        (FL_DOLLAR|FL_BANG|FL_PERCENT|FL_QUOTE)
  1700.  
  1701. #ifndef NULL
  1702. #define NULL 0L
  1703. #endif
  1704.  
  1705. #define CHECKBREAK() dobreak()
  1706.  
  1707. #ifndef AZTEC_C
  1708. struct _dev {
  1709.     long  fd;
  1710.     short mode;
  1711.     };
  1712. #endif
  1713.  
  1714. struct HIST {
  1715.     struct HIST *next, *prev;    /* doubly linked list */
  1716.     char *line;            /* line in history    */
  1717. };
  1718.  
  1719. struct PERROR {
  1720.     int errnum;            /* Format of global error lookup */
  1721.     char *errstr;
  1722. };
  1723.  
  1724. struct DPTR {                /* Format of directory fetch pointer */
  1725.     BPTR lock;            /* lock on directory   */
  1726.     FIB *fib;            /* mod'd fib for entry */
  1727.     };
  1728.  
  1729. extern struct HIST *H_head, *H_tail;
  1730. extern struct PERROR Perror[];
  1731. extern struct DPTR *dopen();
  1732. extern char *set_var(), *get_var(), *next_word();
  1733. extern char *get_history(), *compile_av(), *get_pwd();
  1734. extern char *malloc(), *strcpy(), *strcat(), *index();
  1735. extern char **expand();
  1736. extern char *av[];
  1737. extern char *Current;
  1738. extern int  H_len, H_tail_base, H_stack;
  1739. extern int  E_stack;
  1740. extern int  Src_stack, If_stack, forward_goto;
  1741. extern int  ac;
  1742. extern int  debug, Rval, Verbose, disable, Quit;
  1743. extern int  Lastresult;
  1744. extern int  Exec_abortline;
  1745. extern int   S_histlen;
  1746. extern unsigned int options;
  1747. extern long  Cin, Cout, Cout_append;
  1748. extern char *Cin_name, *Cout_name;
  1749. extern char  Cin_type,  Cout_type;  /* these variables are in transition */
  1750. extern char *Pipe1, *Pipe2;
  1751.  
  1752. extern long Errno;
  1753. extern long Src_base[MAXSRC];
  1754. extern long Src_pos[MAXSRC];
  1755. extern char If_base[MAXIF];
  1756. extern struct Process *Myprocess;
  1757. extern struct CommandLineInterface *Mycli;
  1758.  
  1759. extern long atol(), Atol(), myatol();
  1760. SHAR_EOF
  1761. cat << \SHAR_EOF > shellfunctions.h
  1762. typedef    long    cList;
  1763. extern int Enable_Abort;
  1764.  
  1765. long                    AbleICR();
  1766. long                    AbortIO();
  1767. long                    ActivateGadget();
  1768. void                    ActivateWindow();
  1769. void                    AddAnimOb();
  1770. void                    AddBob();
  1771. void                    AddConfigDev();
  1772. void                    AddDevice();
  1773. long                    AddDosNode();
  1774. void                    AddFont();
  1775. void                    AddFreeList();
  1776. short                    AddGadget();
  1777. unsigned short                AddGList();
  1778. void                    AddHead();
  1779. struct Interrupt *            AddICRVector();
  1780. void                    AddIntServer();
  1781. void                    AddLibrary();
  1782. long                    AddMemList();
  1783. void                    AddPort();
  1784. void                    AddResource();
  1785. void                    AddSemaphore();
  1786. void                    AddTail();
  1787. void                    AddTask();
  1788. void                    AddTime();
  1789. void                    AddVSprite();
  1790. long                    Alert();
  1791. void *                    AllocAbs();
  1792. long                    AllocBoardMem();
  1793. cList                    AllocCList();
  1794. struct ConfigDev *            AllocConfigDev();
  1795. struct MemList *            AllocEntry();
  1796. unsigned long                AllocExpansionMem();
  1797. void *                    AllocMem();
  1798. long                    AllocPotBits();
  1799. void *                    AllocRaster();
  1800. char *                    AllocRemember();
  1801. long                    AllocSignal();
  1802. long                    AllocTrap();
  1803. struct WBObject *            AllocWBObject();
  1804. void *                    Allocate();
  1805. void                    AlohaWorkbench();
  1806. void                    AndRectRegion();
  1807. long                    AndRegionRegion();
  1808. void                    Animate();
  1809. short                    AreaDraw();
  1810. long                    AreaEllipse();
  1811. void                    AreaEnd();
  1812. short                    AreaMove();
  1813. void                    AskFont();
  1814. long                    AskSoftStyle();
  1815. long                    AttemptLockLayerRom();
  1816. long                    AttemptSemaphore();
  1817. short                    AutoRequest();
  1818. long                    AvailFonts();
  1819. long                    AvailMem();
  1820. void                    BeginIO();
  1821. void                    BeginRefresh();
  1822. void                    BeginUpdate();
  1823. void                    BeginLayer();
  1824. long                    BltBitMap();
  1825. long                    BltBitMapRastPort();
  1826. void                    BltClear();
  1827. void                    BltMaskBitMapRastPort();
  1828. void                    BltPattern();
  1829. void                    BltTemplate();
  1830. struct Window *                BuildSysRequest();
  1831. char *                    BumpRevision();
  1832. void                    Cause();
  1833. void                    CBump();
  1834. struct Events *                CDInputHandler();
  1835. void                    ChangeSprite();
  1836. struct IORequest *            CheckIO();
  1837. short                    ClearDMRequest();
  1838. void                    ClearEOL();
  1839. void                    ClearMenuStrip();
  1840. void                    ClearPointer();
  1841. void                    ClearRegion();
  1842. long                    ClearRectRegion();
  1843. void                    ClearScreen();
  1844. void                    ClipBit();
  1845. void                    Close();
  1846. void                    CloseDevice();
  1847. void                    CloseFont();
  1848. void                    CloseLibrary();
  1849. void                    CloseScreen();
  1850. void                    CloseWindow();
  1851. short                    CloseWorkBench();
  1852. void                    CMove();
  1853. short                    CmpTime();
  1854. long                    ConcatCList();
  1855. long                    ConfigBoard();
  1856. long                    ConfigChain();
  1857. long                    ConsoleDevice();
  1858. long                    CopperListInit();
  1859. cList                    CopyCList();
  1860. void                    CopyMem();
  1861. void                    CopyMemQuick();
  1862. void                    CopySBitMap();
  1863. struct Layer *                CreateBehindLayer();
  1864. BPTR        CreateDir();
  1865. struct MsgPort *            CreatePort();
  1866. struct Process *            CreateProc();
  1867. struct IOStdReq *            CreateStdIO();
  1868. struct Task *                CreateTask();
  1869. struct Layer *                CreateUpfrontLayer();
  1870. BPTR                    CurrentDir();
  1871. void                    CurrentTime();
  1872. void                    CWait();
  1873. long *                    DateStamp();
  1874. void                    Deallocate();
  1875. void                    Debug();
  1876. void                    Delay();
  1877. short                    DeleteFile();
  1878. void                    DeleteLayer();
  1879. void                    DeletePort();
  1880. void                    DeleteStdIO();
  1881. void                    DeleteTask();
  1882. struct Process *            DeviceProc();
  1883. void                    Disable();
  1884. void                    DisownBlitter();
  1885. short                    DisplayAlert();
  1886. void                    DisplayBeep();
  1887. void                    DisposeRegion();
  1888. void                    DoCollision();
  1889. long                    DoIO();
  1890. short                    DoubleClick();
  1891. void                    Draw();
  1892. void                    DrawBorder();
  1893. void                    DrawEllipse();
  1894. void                    DrawGList();
  1895. void                    DrawImage();
  1896. BPTR                    DupLock();
  1897. void                    Enable();
  1898. void                    EndRefresh();
  1899. void                    EndRequest();
  1900. void                    EndUpdate();
  1901. void                    Enqueue();
  1902. short                    ExNext();
  1903. short                    Examine();
  1904. short                    Execute();
  1905. void                    Exit();
  1906. struct ConfigDev *            FindConfigDev();
  1907. struct Node *                FindName();
  1908. struct MsgPort *            FindPort();
  1909. struct Resident *            FindResident();
  1910. struct SignalSemaphore *        FindSemaphore();
  1911. struct Task *                FindTask();
  1912. char *                    FindToolType();
  1913. short                    Flood();
  1914. void                    FlushCList();
  1915. void                    Forbid();
  1916. void                    FreeBoardMem();
  1917. void                    FreeCList();
  1918. void                    FreeColorMap();
  1919. void                    FreeConfigDev();
  1920. void                    FreeCopList();
  1921. void                    FreeCprList();
  1922. void                    FreeDiskObject();
  1923. void                    FreeEntry();
  1924. void                    FreeExpansionMem();
  1925. void                    FreeFreeList();
  1926. void                    FreeGBuffers();
  1927. void                    FreeMem();
  1928. void                    FreePotBits();
  1929. void                    FreeRaster();
  1930. void                    FreeRemember();
  1931. void                    FreeSignal();
  1932. void                    FreeSprite();
  1933. void                    FreeSysRequest();
  1934. void                    FreeTrap();
  1935. void                    FreeVPortCopLists();
  1936. void                    FreeWBObject();
  1937. long                    GetCC();
  1938. long                    GetCLBuf();
  1939. short                    GetCLChar();
  1940. short                    GetCLWord();
  1941. struct ColorMap *            GetColorMap();
  1942. long                    GetCurrentBinding();
  1943. struct Preferences *            GetDefPrefs();
  1944. struct DiskObject *            GetDiskObject();
  1945. short                    GetGBuffers();
  1946. long                    GetIcon();
  1947. struct Message *            GetMsg();
  1948. struct Preferences *            GetPrefs();
  1949. short                    GetRGB4();
  1950. long                    GetScreenData();
  1951. short                    GetSprite();
  1952. struct WBObject *            GetWBObject();
  1953. long                    IncrCLMark();
  1954. short                    Info();
  1955. void                    InitArea();
  1956. void                    InitBitMap();
  1957. long                    InitCLPool();
  1958. void                    InitCode();
  1959. void                    InitGMasks();
  1960. void                    InitGels();
  1961. void                    InitMasks();
  1962. void                    InitRastPort();
  1963. void                    InitRequester();
  1964. void                    InitResident();
  1965. void                    InitSemaphore();
  1966. void                    InitStruct();
  1967. void                    InitTmpRas();
  1968. void                    InitVPort();
  1969. void                    InitView();
  1970. BPTR                    Input();
  1971. void                    Insert();
  1972. struct Region *                InstallClipRegion();
  1973. long                    IntuiTextLength();
  1974. struct InputEvent *            Intuition();
  1975. long                    IoErr();
  1976. short                    IsInteractive();
  1977. struct MenuItem *            ItemAddress();
  1978. void                    LoadRGB4();
  1979. struct Segment *            LoadSeg();
  1980. void                    LoadView();
  1981. BPTR                    Lock();
  1982. void                    LockLayer();
  1983. void                    LockLayerInfo();
  1984. void                    LockLayerRom();
  1985. void                    LockLayers();
  1986. struct DeviceNode *            MakeDosNode();
  1987. long                    MakeFunctions();
  1988. struct Library *            MakeLibrary();
  1989. void                    MakeScreen();
  1990. void                    MakeVPort();
  1991. long                    MarkCList();
  1992. long                    MatchToolValue();
  1993. void                    ModifyIDCMP();
  1994. void                    ModifyProp();
  1995. void                    Move();
  1996. long                    MoveLayer();
  1997. void                    MoveScreen();
  1998. void                    MoveSprite();
  1999. void                    MoveWindow();
  2000. void                    MrgCop();
  2001. void                    NewList();
  2002. void                    NewModifyProp();
  2003. struct Region *                NewRegion();
  2004. void                    ObtainConfigBinding();
  2005. void                    ObtainSemaphore();
  2006. void                    ObtainSemaphoreList();
  2007. void                    OffGadget();
  2008. void                    OffMenu();
  2009. void                    OnGadget();
  2010. void                    OnMenu();
  2011. BPTR                    Open();
  2012. long                    OpenDevice();
  2013. struct Font *                OpenDiskFont();
  2014. struct Font *                OpenFont();
  2015. void                    OpenIntuition();
  2016. struct Library *            OpenLibrary();
  2017. struct MiscResource *            OpenResource();
  2018. struct Screen *                OpenScreen();
  2019. struct Window *                OpenWindow();
  2020. short                    OpenWorkBench();
  2021. void                    OrRectRegion();
  2022. long                    OrRegionRegion();
  2023. BPTR                    Output();
  2024. void                    OwnBlitter();
  2025. BPTR                    ParentDir();
  2026. short                    PeekCLMark();
  2027. void                    Permit();
  2028. void                    PolyDraw();
  2029. void                    PrintIText();
  2030. long                    PutCLBuf();
  2031. long                    PutCLChar();
  2032. long                    PutCLWord();
  2033. short                    PutDiskObject();
  2034. long                    PutIcon();
  2035. void                    PutMsg();
  2036. long                    PutWBObject();
  2037. void                    QBSBlit();
  2038. void                    QBlit();
  2039. short                    RawKeyConvert();
  2040. long                    Read();
  2041. char                    ReadExpansionByte();
  2042. long                    ReadExpansionRom();
  2043. short                    ReadPixel();
  2044. void                    RectFill();
  2045. void                    RefreshGadgets();
  2046. void                    RefreshGList();
  2047. void                    RefreshWindowFrame();
  2048. void                    ReleaseConfigBinding();
  2049. void                    ReleaseSemaphore();
  2050. void                    ReleaseSemaphoreList();
  2051. void                    RemConfigDev();
  2052. long                    RemDevice();
  2053. void                    RemFont();
  2054. struct Node *                RemHead();
  2055. void                    RemIBob();
  2056. void                    RemICRVector();
  2057. void                    RemIntServer();
  2058. long                    RemLibrary();
  2059. unsigned short                RemoveGList();
  2060. void                    RemPort();
  2061. void                    RemResource();
  2062. void                    RemSemaphore();
  2063. struct Node *                RemTail();
  2064. void                    RemTask();
  2065. void                    RemVSprite();
  2066. void                    RemakeDisplay();
  2067. void                    Remove();
  2068. unsigned short                RemoveGadget();
  2069. short                    Rename();
  2070. void                    ReplyMsg();
  2071. void                    ReportMouse();
  2072. short                    Request();
  2073. void                    RethinkDisplay();
  2074. void                    ScreenToBack();
  2075. void                    ScreenToFront();
  2076. void                    ScrollLayer();
  2077. void                    ScrollRaster();
  2078. void                    ScrollVPort();
  2079. long                    Seek();
  2080. void                    SendIO();
  2081. void                    SetAPen();
  2082. void                    SetBPen();
  2083. void                    SetCollision();
  2084. short                    SetComment();
  2085. void                    SetCurrentBinding();
  2086. short                    SetDMRequest();
  2087. void                    SetDRMd();
  2088. long                    SetExcept();
  2089. long                    SetFont();
  2090. long                    SetFunction();
  2091. long                    SetICR();
  2092. struct Interrupt *            SetIntVector();
  2093. short                    SetMenuStrip();
  2094. void                    SetPointer();
  2095. struct Preferences *            SetPrefs();
  2096. short                    SetProtection();
  2097. void                    SetRast();
  2098. void                    SetRGB4();
  2099. void                    SetRGB4CM();
  2100. long                    SetSR();
  2101. long                    SetSignal();
  2102. long                    SetSoftStyle();
  2103. short                    SetTaskPri();
  2104. void                    SetWindowTitles();
  2105. void                    ShowTitle();
  2106. void                    Signal();
  2107. long                    SizeCList();
  2108. short                    SizeLayer();
  2109. void                    SizeWindow();
  2110. void                    SortGList();
  2111. cList                    SplitCList();
  2112. cList                    SubCList();
  2113. void                    SubTime();
  2114. void                    SubLibrary();
  2115. void                    SumKickData();
  2116. long                    SuperState();
  2117. void                    SwapBitsRastPortClipRect();
  2118. void                    SyncSBitMap();
  2119. long                    Text();
  2120. long                    TextLength();
  2121. long                    Translate();
  2122. long                    UnGetCLChar();
  2123. long                    UnGetCLWord();
  2124. void                    UnLoadSeg();
  2125. void                    UnLock();
  2126. short                    UnPutCLChar();
  2127. short                    UnPutCLWord();
  2128. void                    UnlockLayer();
  2129. void                    UnlockLayerInfo();
  2130. void                    UnlockLayerRom();
  2131. void                    UnlockLayers();
  2132. short                    UpfrontLayer();
  2133. void                    UserState();
  2134. short                    VBeamPos();
  2135. struct View *                ViewAddress();
  2136. struct ViewPort *            ViewPortAddress();
  2137. short                    WBenchToBack();
  2138. short                    WBenchToFront();
  2139. long                    Wait();
  2140. void                    WaitBOVP();
  2141. void                    WaitBlit();
  2142. short                    WaitForChar();
  2143. long                    WaitIO();
  2144. struct Message *            WaitPort();
  2145. void                    WaitTOF();
  2146. struct Layer *                WhichLayer();
  2147. short                    WindowLimits();
  2148. void                    WindowToBack();
  2149. void                    WindowToFront();
  2150. long                    Write();
  2151. long                    WriteExpansionByte();
  2152. void                    WritePixel();
  2153. void                    WritePotgo();
  2154. void                    XorRectRegion();
  2155. long                    XorRegionRegion();
  2156. SHAR_EOF
  2157. #    End of shell archive
  2158. exit 0
  2159. -- 
  2160. Bob Page, U of Lowell CS Dept.  page@swan.ulowell.edu  ulowell!page
  2161. Have five nice days.
  2162.